<?php
class post_model extends my_model{

	function __construct(){
		parent::__construct();
		$this->_prefix = "pos";
		$this->_column = array(
								'id'						=>$this->_prefix."_id",
								'title'					=>$this->_prefix."_title",
								'content'				=>$this->_prefix."_content",
								'usr_ip'				=>$this->_prefix."_usr_ip",
								'status'				=>$this->_prefix."_status",
								'comment_status'=>$this->_prefix."_comment_status",
								'usr_id'				=>$this->_prefix."_usr_id",
								'cat_id'				=>$this->_prefix."_cat_id",
								'typ_id'				=>$this->_prefix."_typ_id",
								'cr_date'				=>$this->_prefix."_cr_date",
								'lu_date'				=>$this->_prefix."_lu_date",
								'lu_uid'				=>$this->_prefix."_lu_uid",
								'update_date'		=>$this->_prefix."_update_date",
								'url'						=>$this->_prefix."_url",
								'type'					=>$this->_prefix."_type",
								'code'					=>$this->_prefix."_code",
								'view'					=>$this->_prefix."_view"
		);

		$this->_join_column = array(
								'username'		=> "usr_username",
								'password'		=> "usr_password",
								'email'				=> "usr_email",
								'gender'			=> "usr_gender",
								'firstname'		=> "usr_firstname",
								'lastname'		=> "usr_lastname",
								'mobile'			=> "usr_mobile",
								'phone'				=> "usr_phone",
								'address'			=> "usr_address",
								'district'		=> "usr_district",
								'province'		=> "usr_province",
								'zipcode'			=> "usr_zipcode",
								'usr_status'	=> "usr_status",
								'group'				=> "usr_group",
								'lastactive'	=> "usr_lastactive",
								'registered'	=> "usr_registered"

		);
	}

	function get($options = NULL){
    $this->db->join("ci_user","ci_user.usr_id = ci_post.pos_usr_id");
    $this->db->where("pos_type","post");
    $mainTable = parent::get($options);
    return $mainTable;
  }


	function getPostByGroup($options = NULL){
    //$this->db->join("ci_group","ci_group.grp_id = ci_user.usr_group");
    $mainTable = self::get($options);
    return $mainTable;
	}

	function add($options = NULL){
		$this->db->set("pos_type","post");
		return parent::add($options);
	}

}
?>